load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
    name = "mylib",
    srcs = ["mylib.rs"],
    edition = "2018",
    deps = [":lib_dep"],
)

rust_library(
    name = "lib_dep",
    srcs = ["lib_dep.rs"],
    edition = "2018",
)

rust_test(
    name = "mylib_test",
    crate = ":mylib",
    edition = "2018",
    deps = [":extra_test_dep"],
)

rust_library(
    name = "extra_test_dep",
    srcs = ["extra_test_dep.rs"],
    edition = "2018",
)

rust_test(
    name = "rust_project_json_test",
    srcs = ["rust_project_json_test.rs"],
    data = [":rust-project.json"],
    edition = "2018",
    env = {"RUST_PROJECT_JSON": "$(rootpath :rust-project.json)"},
    # This target is tagged as manual since it's not expected to pass in
    # contexts outside of `//test/rust_analyzer:rust_analyzer_test`. Run
    # that target to execute this test.
    tags = ["manual"],
)
